package com.jinghua.treatment.wechat.entity;

import java.util.Date;

public class WXJSConfig {

    private boolean debug = false;
    private String appId ;
    private long timestamp ;
    private String nonceStr ;
    private String signature ;

    private String jsapi_ticket;

    private Date ticketTime;

    public Date getTicketTime() {
        return ticketTime;
    }

    public void setTicketTime(Date ticketTime) {
        this.ticketTime = ticketTime;
    }

    public String getJsapi_ticket() {
        return jsapi_ticket;
    }

    public void setJsapi_ticket(String jsapi_ticket) {
        this.jsapi_ticket = jsapi_ticket;
    }

    public WXJSConfig(){}

    public WXJSConfig(boolean debug, String appId, long timestamp, String nonceStr, String signature) {
        this.debug = debug;
        this.appId = appId;
        this.timestamp = timestamp;
        this.nonceStr = nonceStr;
        this.signature = signature;
    }


    public boolean isTicketValid(){
        boolean flag = false;
        if(ticketTime!=null){
            long t1 = new Date().getTime();
            long t2 = ticketTime.getTime();
            flag = (t1-t2 ) < 7100;
        }
        return flag;
    }

    public boolean isDebug() {
        return debug;
    }

    public void setDebug(boolean debug) {
        this.debug = debug;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    public String getNonceStr() {
        return nonceStr;
    }

    public void setNonceStr(String nonceStr) {
        this.nonceStr = nonceStr;
    }

    public String getSignature() {
        return signature;
    }

    public void setSignature(String signature) {
        this.signature = signature;
    }
}
